package com.three.controller;

import com.three.dao.LoginDao;
import com.three.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.Objects;

@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;
    private LoginDao loginDao;
    @RequestMapping("/login")
    public Object login(@RequestBody Map<String, Object> map) {
        String username = (String)map.get("username");
        String password = (String)map.get("password");
        if (Objects.equals(password, "123456")){
            return loginService.login(username,password);
        }else{
            return loginService.logins(username, password);
        }
    }
}
